<?php
if(!function_exists('get_css')){
    
    function get_css()
    {
        $ci = &get_instance();
        $css_files  = $ci->config->item('css_files');
        $asset_path = $ci->config->item('base_url').'/public/';
        array_push($css_files,
                '<link rel="stylesheet" href="'.$asset_path.'assets/css/styles.css?=121">',
                "<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600' rel='stylesheet' type='text/css'>",
                "<link href='".$asset_path."assets/demo/variations/default.css' rel='stylesheet' type='text/css' media='all' id='styleswitcher'>",
                "<link href='".$asset_path."assets/demo/variations/default.css' rel='stylesheet' type='text/css' media='all' id='headerswitcher'>"
        );
        
        $ci->config->set_item('css_files',$css_files);
        return  $ci->config->item('css_files');
    }
    function add_css($name,$attributes = NULL)
    {
        $ci = &get_instance();
        $asset_path = $ci->config->item('base_url').'/public/';
        $css_files  = $ci->config->item('css_files');
        array_push($css_files,
        "<link href='".$asset_path."".$name."' rel='stylesheet' type='text/css' media='all' ".$attributes.">"
        );
        $ci->config->set_item('css_files',$css_files);
            
    }
    function get_js()
    {
        $ci = &get_instance();
        $js_files  = $ci->config->item('js_files');
        $asset_path = $ci->config->item('base_url').'/public/';
        

        $defaults = array(
                "<script type='text/javascript' src='".$asset_path."assets/js/jquery-1.10.2.min.js'></script>", 
                "<script type='text/javascript' src='".$asset_path."assets/js/jqueryui-1.10.3.min.js'></script>", 
                "<script type='text/javascript' src='".$asset_path."assets/js/bootstrap.min.js'></script>" ,
                "<script type='text/javascript' src='".$asset_path."assets/js/enquire.js'></script>" ,
                "<script type='text/javascript' src='".$asset_path."assets/js/jquery.cookie.js'></script>",
                "<script type='text/javascript' src='".$asset_path."assets/js/jquery.nicescroll.min.js'></script>",
                "<script type='text/javascript' src='".$asset_path."assets/plugins/codeprettifier/prettify.js'></script>",
                "<script type='text/javascript' src='".$asset_path."assets/plugins/easypiechart/jquery.easypiechart.min.js'></script>" ,
                "<script type='text/javascript' src='".$asset_path."assets/plugins/sparklines/jquery.sparklines.min.js'></script>", 
                "<script type='text/javascript' src='".$asset_path."assets/plugins/form-toggle/toggle.min.js'></script>",
                "<script type='text/javascript' src='".$asset_path."assets/js/placeholdr.js'></script>", 
                "<script type='text/javascript' src='".$asset_path."assets/js/application.js'></script>" ,
                "<script type='text/javascript' src='".$asset_path."assets/demo/demo.js'></script>"         
        );
        foreach($defaults as $value){
            if(!in_array($value, $js_files, true)){
                array_push($js_files, $value);
            }
        }        
        $ci->config->set_item('js_files',$js_files);
        return  $ci->config->item('js_files');        
        
    }
    function add_js($name)
    {
        $ci = &get_instance();
        $asset_path = $ci->config->item('base_url').'/public/';
        $js_files  = $ci->config->item('js_files');
        $value = "<script type='text/javascript' src='".$asset_path."".$name."'></script>" ;
        if(!in_array($value, $js_files, true)){
                array_push($js_files, $value);
        }
        $ci->config->set_item('js_files',$js_files);        
    }
}

?>